package com.gusha.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name="sys_comment")
@NamedQuery(name="SysComment.findAll", query="SELECT s FROM SysComment s")
@DynamicInsert
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SysComment implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	private BigInteger id;
	//资讯id
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="content_id")
	private InfoContent contentId;
	//评论用户id
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="user_id")
	private User userId;
	
	@Column(name="comment")
	private String comment;
	
	@Column(name="is_delete")
	private BigInteger isDelete;
	
	@Column(name="state")
	private BigInteger state;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="comment_time")
	private Date commentTime;
	
	@Column(name="is_check")
	private BigInteger isCheck;

	public BigInteger getId() {
		return id;
	}

	public void setId(BigInteger id) {
		this.id = id;
	}

	public InfoContent getContentId() {
		return contentId;
	}

	public void setContentId(InfoContent contentId) {
		this.contentId = contentId;
	}

	public User getUserId() {
		return userId;
	}

	public void setUserId(User userId) {
		this.userId = userId;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public BigInteger getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(BigInteger isDelete) {
		this.isDelete = isDelete;
	}

	public BigInteger getState() {
		return state;
	}

	public void setState(BigInteger state) {
		this.state = state;
	}

	public Date getCommentTime() {
		return commentTime;
	}

	public void setCommentTime(Date commentTime) {
		this.commentTime = commentTime;
	}

	public BigInteger getIsCheck() {
		return isCheck;
	}

	public void setIsCheck(BigInteger isCheck) {
		this.isCheck = isCheck;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
}
